//package com.zhihesj.anan.config.quartz;
//
//import org.quartz.*;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
///**
// * @author anan.
// * @version 1.0
// * @create 2020-10-29 09-44
// */
//@Configuration
//public class QuartzConfig {
//
//    /**
//     * 定时任务
//     * @return
//     */
//    @Bean
//    public JobDetail myJobDetail(){
//        JobDetail jobDetail = JobBuilder.newJob(HiJob.class)
//                .withIdentity("myJobDetail")
////                .withIdentity("MyJob1","myJobGroup1")
//                //JobDataMap可以给任务execute传递参数
////                .usingJobData("job_param","job_param1")
//                .storeDurably()
//                .build();
//        return jobDetail;
//    }
//
//    /**
//     * 触发器，每间隔一段时间触发定时任务
//     * @return
//     */
//    @Bean
//    public Trigger myTrigger(@Qualifier("myJobDetail") JobDetail jobDetail){
////        Trigger trigger = TriggerBuilder.newTrigger()
////                .forJob(myJobDetail())
////                .withIdentity("myTrigger1","myTriggerGroup1")
////                .usingJobData("job_trigger_param","job_trigger_param1")
////                .startNow()
////                // .withSchedule(SimpleScheduleBuilder.simpleSchedule().withIntervalInSeconds(5).repeatForever())
////                .withSchedule(CronScheduleBuilder.cronSchedule("0/5 * * * * ? 2020"))
////                .build();
////        return trigger;
//        ScheduleBuilder scheduleBuilder = SimpleScheduleBuilder
//                .simpleSchedule()
//                .withIntervalInSeconds(3) // 定时任务间隔时间
//                .repeatForever(); // 触发器无限循环触发
//        return TriggerBuilder.newTrigger()
//                .forJob(jobDetail)
//                .withIdentity("testJobTrigger")
//                .withSchedule(scheduleBuilder)
//                .build();
//
//    }
//
//
//}
